package com.batchaps.classes;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import com.batchaps.global.GameEngine;
import com.batchaps.menu.GameMenu;

public class TwoPersonPlay extends KindOfPlay{

	public TwoPersonPlay(GameMenu gm)
	{
		this.gameMenu = gm;
		this.isV0 = false;
		this.V0 = 0;
		GameEngine.IsWhoPlay = true;
		try {
			this.imgPower = Image.createImage("/menu/power.png");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		this.isDrawPower = false;
	}
	
	public void Update() {
		// TODO Auto-generated method stub
		if(isV0)
			V0 += GameEngine.IV0;
	}

	public void PointerPress(int x, int y) {
		// TODO Auto-generated method stub
		if(GameEngine.IsWhoPlay){
			if(gameMenu.dog.IsClick(x, y))
				isV0 = true;
		}
		else{
			if(gameMenu.cat.IsClick(x, y))
				isV0 = true;
		}
		
	}

	public void PointerRelease(int x, int y) {
		// TODO Auto-generated method stub
		if(GameEngine.IsWhoPlay){
			if(gameMenu.dog.IsClick(x, y))
			{
				gameMenu.dog.PlayBullet(V0);
				isV0 = false;
				V0 = 0;
			}
		}
		else{
			if(gameMenu.cat.IsClick(x, y))
			{
				gameMenu.cat.PlayBullet(V0);
				isV0 = false;
				V0 = 0;
			}
		}
	}

}
